home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
local
/
uiResources.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
7KB
|
190 lines
<?php
/**
* User Interface resources tab
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 2.0.0
*/
// Indicate an in-application display
$_ENV['configurationEnvironment']='application';
require_once(INCLUDE_DIR.'outputFunctions.php');
/**
***************************************************************************************************************************
* Process Async command
***************************************************************************************************************************
*/
if(cfIsAsync()){
cfAsyncHeader();
// Selected accordion update
if(isset($_POST['uiResouceAccordionUpdated'])){
cfGUpdateVar('uiResourceAccordion',$_POST['uiResouceAccordionUpdated']);
}
die(cfAsyncFooter());
}
/**
* Detect Windows shell extension (context menu) request for share / send / publish
*/
if(file_exists($shellExt=cfAppTempDir().'/shellExtShared')){
$shellExtFiles=explode("\r\n",file_get_contents($shellExt));
$shellAction=array_shift($shellExtFiles);
// Pre-process files array
$files=array(); foreach ($shellExtFiles as $utf8File) $files[]=utf8_decode(str_replace('\\','/',$utf8File));
if(count($files)>0) if($files[count($files)-1]=='') array_pop($files);
// Select iframe
cfGUpdateVar('uiResourceAccordion',$shellAction);
// Pass files list to relevant iframe
cfGSetVar('uiResourceShellAction',$files,true);
// Remove file so it's not used another time
@unlink($shellExt);
}
// UI request to select a given resource through GET parameter
if(isset($_GET['resSelectedId'])) {
$rfn=cfArrayItem(cfMGetVar('weezoResourcesList'),$_GET['resSelectedId']);
if($rfn) {
cfGUpdateVar('uiResourceSelected',$rfn);
cfGUpdateVar('uiResourceAccordion','share');
}
}
/**
***************************************************************************************************************************
* Insert page HEADER
***************************************************************************************************************************
*/
cfInsertHEAD(false);
?>
</head>
<body style="padding:0;margin:0;overflow:hidden">
<?php
echo cfScriptLink('wz_dragdrop.js');
// Prepare accordion tabs
$tabs=array();
$tabs['share']=array('caption'=>strtoupper(cfCaption('doShare')),'src'=>'/local/uiResources/share.php','icon'=>outIcon('resources24'));
$tabs['send']=array('caption'=>strtoupper(cfCaption('doSend')),'src'=>'/local/uiResources/send.php','icon'=>outIcon('directLink24'),'scroll'=>true);
$tabs['publish']=array('caption'=>strtoupper(cfCaption('doPublish')),'src'=>'/local/uiResources/publish.php','icon'=>outIcon('icoXML24'),'scroll'=>true);
// Select publish panel
if(cfGGetVar('uiResourcePublishPanel')) $tabs['publish']['src']='/local/uiResources/'.cfGGetVar('uiResourcePublishPanel').'.php';
// Select default tab
$uiRA=cfGGetVar('uiResourceAccordion'); if(!$uiRA) $uiRA='share';
switch ($uiRA){
case 'share':
case 'send':
case 'publish':
$tabs[$uiRA]['selected']=true;
break;
default:
$tabs['share']['selected']=true;
}
//$tabs['send']['src']='/gfx/ok.png';
outAccordion($tabs,800,453,array('callback'=>'uiResouceAccordionUpdated','hideFolded'=>1));
/**
* Script and inputs required to forward UI response to resource config iframe
*/
?>
<script type="text/javascript">
var uiResourceAccordion="<?php echo $uiRA; ?>";
function uiResouceAccordionUpdated(newTabName,prevTabName){
uiResourceAccordion=newTabName;
sendData('uiResouceAccordionUpdated='+newTabName);
if(frames[newTabName].tabSelected) frames[newTabName].tabSelected(1,newTabName);
if(frames[prevTabName].tabSelected) frames[prevTabName].tabSelected(0,prevTabName);
if(newTabName=='publish') {
var l=''+frames[newTabName].document.location;
var cmp='/local/uiResources/publish.php';
if(l.substr(l.length-cmp.length)!=cmp) frames[newTabName].document.location=cmp;
}
}
// Forward commands from UI to right iframe
function forwardUICommand(){
var f=frames[uiResourceAccordion];// Forward to selected accordion's frame
// web popup response to resource creation
if(dgi("UIReturnValue").value.substr(0,12)=='newResource:'){
dgi("UIReturnValue").value=dgi("UIReturnValue").value.substr(12);
}
// File drop/openfile(s) if selected accordion is share: forward to resource frame
else if(uiResourceAccordion=='share') f=frames['share'].frames['resourceConfigFrame'];
// Get var name and value
var varName=dgi("UIReturnVarName").value, value=dgi("UIReturnValue").value;
// webBrowser control display redraw bug workaround
if(varName=='UIRefreshCmd') return redrawDisplay();
var n=f.dgi(varName);
if(!n) n=f.dgn(varName);
if(!n) return;
n.value=value;
if(n.onkeyup) n.onkeyup();
}
// Sliding frames
var slideFramePrev,slideFrameSteps=10;
function slideFrame(frameName, URL, dir){
var prev,next;
if(!(prev=dgi(frameName).getElementsByTagName('IFRAME')[0])) return false;
prev.src=URL;
}
function slideFrameAnim(step,dir){
var t=slideFramePrev.offsetHeight*(((dir=='up')?-1:1)*(slideFrameSteps-step)/slideFrameSteps);
slideFramePrev.style.top=t
if(dir=='up') dgi("slideFrame").style.top=t+slideFramePrev.offsetHeight;
else dgi("slideFrame").style.top=t-slideFramePrev.offsetHeight
if(step>0) setTimeout('slideFrameAnim("'+(step-1)+'","'+dir+'")',1)
else{
removeNode(slideFramePrev);
slideFramePrev=null;
with(slideFramePrev=dgi("slideFrame")){
style.zIndex=style.position='';
style.top=style.left=0;
style.height='100%';
id='';
}
}
}
// webBrowser control display redraw bug workaround
function redrawDisplay(){
dgi("redrawMask").style.display="";
setTimeout('dgi("redrawMask").style.display="none"',100);
}
</script>
<input type="hidden" id="UIReturnVarName" name="UIReturnVarName">
<input type="hidden" id="UIReturnValue" name="UIReturnValue" onkeyup="forwardUICommand()">
<div id="redrawMask" style="position:absolute;top:0px;left:0px;width:100%;height:100%;background:white;display:none;filter:Alpha(opacity=1,style=0)">
<?php
echo cfDragRegisterItems('');
?>
</body>